import store from './store/index.js'
import {
	getToken
} from './utils/auth.js'
store.dispatch('user/getGuestCarts');
if (getToken()) {
	store.dispatch('user/getInfo').then( res => {
		store.dispatch('user/createCart');
		let price = 0, arry = [];
		for (let i in res) {
			price += res[i].price;
			res[i].id = res[i].item_id;
			arry.push(res[i])
		}
		store.commit("product/SET_PRODUCTLIST", arry);
		store.commit("product/SET_PRICETPTAL", price);
	});
}